var bonus = document.querySelector(".bonus")
var bonus_wrap = document.querySelector(".bonus_wrap");
var bonus_num = document.querySelectorAll(".bonus>p");
//创建多个金蛋
let egg_ul = document.querySelector("ul.egg_list");
for(let i = 1;i<89;i++){
	let egg_li = document.createElement("li");
	egg_li.className="egg"
	egg_li.innerHTML="<p>"+i+"</p>"
	egg_ul.appendChild(egg_li)
}

//绑定点击事件
let egg_li = document.querySelectorAll("li.egg");
for(let i=0;i<egg_li.length;i++){
	egg_li[i].onclick=function(){
		if(this.childNodes.length!=0){
			this.removeChild(this.childNodes[0])
			this.classList.add('vivify','shake');
			setTimeout(()=>{
				this.style.backgroundImage = "url(img/egg-po.png)"
				bonus_wrap.classList.remove("none")
				bonus_wrap.classList.add("block")
				bonus_wrap.classList.add("vivify","popIn")
				bonus_num[1].innerText = money[i];
			},1000)
			
		}
		
	}
}


bonus.onclick=function(event){
	event.stopPropagation();
}
bonus_wrap.onclick=function(){
	bonus_wrap.classList.remove("block")
	bonus_wrap.classList.add("none");
}